IsNumeric (str)

IsNumeric and NumericText (str) are equivalent functions. However, IsNumeric is preferred in Basic syntax, whereas NumericText is preferred in Crystal syntax.

Argument

str is a String value to be tested.

Returns

Boolean value (True or False).

Action

IsNumeric returns True if the String argument can be converted to a Number and False otherwise.

Typical use

If you store numbers (like weight) in a text String object, use IsNumeric to check the value of each record to make sure it is OK to convert using ToNumber or CDbl.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsNumeric({file.REFERENCE})

Returns FALSE where {file.REFERENCE} = "ABCDEFG".

IsNumeric({file.IDNUM})

Returns TRUE where {file.IDNUM} = "12345".

IsNumeric({file.IDNUM})

Returns TRUE where {file.IDNUM} = "12345443".

IsNumeric({file.IDNUM})

Returns FALSE where {file.IDNUM} = "12345-443".

IsNumeric ({file.IDNUM} (1 to 5))

Returns TRUE where {file.IDNUM} = "12345-443".

IsNumeric ({file.IDNUM} (6))

Returns FALSE where {file.IDNUM} = "12345-443".

IsNumeric ({file.IDNUM} (7 to 9))

Returns TRUE where {file.IDNUM} = "12345-443".

IsNumeric({file.IDNUM})

Returns FALSE where {file.IDNUM} = "12345T".

Note:    You can use this function in combination with ToNumber (numeric), ToNumber (string), ToNumber (Boolean) or CStr to test for a Number in the Reference field, then return the string as a Number or return 0 if the text string is not a Number.

The following example is applicable to Basic syntax:

If IsNumeric({file.IDNUM}) Then

    formula = ToNumber({file.IDNUM})

Else

    formula = 0

End If



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com